<?php

$buttonName = '开始预订';
$bookItem = new BWInputValue($bookingId);
$bookList = new BTreeList($bookItem);
$htmlOptions = array(
    'enctype' => 'multipart/form-data',
    'class' => 'btn btn-info'
);
$ajaxOptions = array(
    'complete' => 'function(){$("#ajax-loaderdiv").hide();$("#myModal").modal("show");}'
);
$addToBookingCartTimeItem = $bookList->getItem('addToBookingCartTime');
if ($addToBookingCartTimeItem instanceof BTreeItem) {
    $addToBookingCartTime = $addToBookingCartTimeItem->value;
    if ($addToBookingCartTime + 15 * 60 > time()) {
        $buttonName = $buttonName = '正在预订';
        $htmlOptions['class'] = 'btn btn-success disabled';
        $ajaxOptions = array();
    }    
}

echo $control->getAjaxLink(array('name' => $buttonName, 'id' => 'showAddBooking'), array(
    'bookingId' => $bookingId,
    //'bookableId' => $bookable->getId(),
    //'ajaxContainerId' => 'myModal',
    'ajaxContainerId' => 'myModal',
    'htmlOptions' => $htmlOptions,
    'ajaxOptions' => $ajaxOptions
));
?>